extern crate bindgen;

fn main() {
    // 链接库路径
    println!("cargo:rustc-link-search=native=/usr/local/lib");
    println!("cargo:rustc-link-lib=static=natserver");

    let bindings = bindgen::Builder::default()
        // 头文件路径
        .header("./natserver.h")
        .parse_callbacks(Box::new(bindgen::CargoCallbacks))
        // 头文件中需要的其他头文件路径
        .clang_arg("-I/usr/include")
        .clang_arg("-I/usr/local/include")
        .clang_arg("-I/usr/lib/gcc/x86_64-openEuler-linux/12/include")
        .generate()
        .expect("Unable to generate bindings");

    bindings
        .write_to_file("src/natserver.rs")
        .expect("Couldn't write bindings!");
}